Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add #ifndef HID_CUSTOM_LAYOUT_HIDE_PRAGMA_MESSAGE #329

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fxkr
Copy link

@fxkr fxkr commented Nov 15, 2021

Currently, on every build using this library, this message is printed:

In file included from .pio/libdeps/promicro/HID-Project/src/SingleReport/../HID-APIs/KeyboardAPI.h:29:0,
                 from .pio/libdeps/promicro/HID-Project/src/SingleReport/../HID-APIs/DefaultKeyboardAPI.h:27,
                 from .pio/libdeps/promicro/HID-Project/src/SingleReport/BootKeyboard.h:30,
                 from .pio/libdeps/promicro/HID-Project/src/HID-Project.h:50,
                 from src/input.h:9,
                 from src/main.cpp:4:
.pio/libdeps/promicro/HID-Project/src/SingleReport/../HID-APIs/../KeyboardLayouts/ImprovedKeylayouts.h:57:21: note: #pragma message: Using custom layout for keyboard modules
     #pragma message "Using custom layout for keyboard modules"

(Or similar, depending on #define's and whether Arduino IDE or PlatformIO is used to build.)

I like to try and keep my errors/warnings/messages count at 0. This makes it easier to see if any in development changes have introduced new warnings (visually by length + color of build output), making for a more pleasant development experience. These messages are printed in scary yellow (PlatformIO) or red (Arduino IDE), and in Arduino IDE they're especially annoying since the build log panel is usually a very small portion of the screen.

Of course personally I would prefer removing the message entirely, but I assume you would not be ok with that (someone must've added it for some reason. maybe it reduces support load or something), so in this PR I'm proposing to at least add a way to disable the message via another #define. Since this is meant for people who're pretty sure they know what they want, I only added the #ifndef to the branch where a layout is already specified. And the default behavior is unchanged.

Does this seem like an acceptable compromise?

@NicoHood
Copy link
Owner

I am not sure if that is a useful idea. I'd expect that the compiler has a flag to turn off pragma messages.

@fxkr
Copy link
Author

fxkr commented Nov 15, 2021

I don't think there is a way to disable #pragma message. I searched; the only thing that came up is this StackOverflow post https://stackoverflow.com/questions/31669021/how-to-silence-pragma-messages-from-gcc that also proposes #ifdef.

Even if there was a compiler option to disable pragma message:

  1. That's difficult/impossible to integrate into the build system (especially in Arduino IDE, where it is impossible to override build options in project specific settings. boards.txt is system wide. Then I could as well patch it out of HID-Project directly.)
  2. If it was done globally (which, I believe, would be the only technically possible way in Arduino IDE), then one wouldn't know if anything else is using them to raise warnings if something is wrong. The goal here is not to "just make it shut up at all cost" (&>/dev/null style), but to reduce noise when all is right.

I believe HID-Project is the only library that I am aware of (at home or at work) that prints something as part of its regular (successful, no warnings) build.

@fxkr fxkr force-pushed the add-ifndef-to-hide-layout-pragma-message branch from 94e552c to 6da5dbc Compare November 15, 2021 09:19
@NicoHood
Copy link
Owner

FastLED also uses the pragma to print the version.

Any thoughts from other community members?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants